package com.yougou.data.model;

import com.google.gson.annotations.SerializedName;

import java.util.List;

public class Order {
    
    @SerializedName("order_id")
    private String orderId;
    
    @SerializedName("order_number")
    private String orderNumber;
    
    @SerializedName("order_price")
    private double orderPrice;
    
    @SerializedName("order_status")
    private int orderStatus; // 1-待付款 2-待发货 3-待收货 4-已完成
    
    @SerializedName("create_time")
    private long createTime;
    
    @SerializedName("pay_time")
    private long payTime;
    
    @SerializedName("goods_list")
    private List<OrderGoods> goodsList;
    
    @SerializedName("consignee_addr")
    private String consigneeAddr;
    
    private String receiverName;
    private String receiverPhone;
    private String receiverAddress;
    
    public String getOrderId() {
        return orderId;
    }
    
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    
    public String getOrderNumber() {
        return orderNumber;
    }
    
    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }
    
    public double getOrderPrice() {
        return orderPrice;
    }
    
    public void setOrderPrice(double orderPrice) {
        this.orderPrice = orderPrice;
    }
    
    public int getOrderStatus() {
        return orderStatus;
    }
    
    public void setOrderStatus(int orderStatus) {
        this.orderStatus = orderStatus;
    }
    
    public long getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }
    
    public long getPayTime() {
        return payTime;
    }
    
    public void setPayTime(long payTime) {
        this.payTime = payTime;
    }
    
    public List<OrderGoods> getGoodsList() {
        return goodsList;
    }
    
    public void setGoodsList(List<OrderGoods> goodsList) {
        this.goodsList = goodsList;
    }
    
    public String getConsigneeAddr() {
        return consigneeAddr;
    }
    
    public void setConsigneeAddr(String consigneeAddr) {
        this.consigneeAddr = consigneeAddr;
    }
    
    public String getReceiverName() {
        return receiverName;
    }
    
    public void setReceiverName(String receiverName) {
        this.receiverName = receiverName;
    }
    
    public String getReceiverPhone() {
        return receiverPhone;
    }
    
    public void setReceiverPhone(String receiverPhone) {
        this.receiverPhone = receiverPhone;
    }
    
    public String getReceiverAddress() {
        return receiverAddress;
    }
    
    public void setReceiverAddress(String receiverAddress) {
        this.receiverAddress = receiverAddress;
    }
    
    
    
    public String getGoodsName() {
        if (goodsList != null && !goodsList.isEmpty()) {
            return goodsList.get(0).getGoodsName();
        }
        return "";
    }
    
    
    public double getPrice() {
        if (goodsList != null && !goodsList.isEmpty()) {
            return goodsList.get(0).getGoodsPrice();
        }
        return 0.0;
    }
    
    
    public int getQuantity() {
        if (goodsList != null && !goodsList.isEmpty()) {
            return goodsList.get(0).getGoodsNumber();
        }
        return 0;
    }
    
    
    public String getImageUrl() {
        if (goodsList != null && !goodsList.isEmpty()) {
            return goodsList.get(0).getGoodsSmallLogo();
        }
        return "";
    }
    
    
    public int getStatus() {
        return orderStatus;
    }
    
    
    public void setStatus(int status) {
        this.orderStatus = status;
    }
    
    
    public String getStatusText() {
        switch (orderStatus) {
            case 1:
                return "待付款";
            case 2:
                return "待发货";
            case 3:
                return "待收货";
            case 4:
                return "已完成";
            default:
                return "未知";
        }
    }
    
    
    public static class OrderGoods {
        @SerializedName("goods_id")
        private int goodsId;
        
        @SerializedName("goods_name")
        private String goodsName;
        
        @SerializedName("goods_price")
        private double goodsPrice;
        
        @SerializedName("goods_number")
        private int goodsNumber;
        
        @SerializedName("goods_small_logo")
        private String goodsSmallLogo;
        
        public int getGoodsId() {
            return goodsId;
        }
        
        public void setGoodsId(int goodsId) {
            this.goodsId = goodsId;
        }
        
        public String getGoodsName() {
            return goodsName;
        }
        
        public void setGoodsName(String goodsName) {
            this.goodsName = goodsName;
        }
        
        public double getGoodsPrice() {
            return goodsPrice;
        }
        
        public void setGoodsPrice(double goodsPrice) {
            this.goodsPrice = goodsPrice;
        }
        
        public int getGoodsNumber() {
            return goodsNumber;
        }
        
        public void setGoodsNumber(int goodsNumber) {
            this.goodsNumber = goodsNumber;
        }
        
        public String getGoodsSmallLogo() {
            return goodsSmallLogo;
        }
        
        public void setGoodsSmallLogo(String goodsSmallLogo) {
            this.goodsSmallLogo = goodsSmallLogo;
        }
    }
}

